<template>
   <div class="tabbar">
    <router-link
      tag="li"
      v-for="nav in navs"
      active-class="tab-active"
      :key="nav.path"
      :to="nav.path"
    >
      <i class="iconfont" v-html="nav.meta.icon"></i>
      <span>{{nav.meta.title}}</span>
    </router-link>
   </div>
</template>

<script>
import routes from '@/router/routes'
export default {
  name: 'Tabbar',
  computed: {
    navs () {
      return routes.filter(route => route.meta?.istab)
    }
  }
}
</script>
<style lang='scss' scoped>
.tabbar {
    display: flex;
    list-style: none;
    font-size: 14px;
    margin: 0;
    padding: 0;
    border-top: 1px solid #eaeaea;
    box-shadow: 0 -2px 5px #eaeaea;

    & > li {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;

      i {
        font-size: 24px;
      }

      .badge {
        display: block;
        width: 30px;
        height: 20px;
        line-height: 20px;
        text-align: center;
        border-radius: 30px;
        background: #f00;
        font-size: 12px;
        color: #fff;
        position: absolute;
        top: -8px;
        right: 12px;
      }
    }

    .tab-active {
      color: #f00;
    }
  }
</style>
